import 'package:shared_preferences/shared_preferences.dart';

class SpUtil {
  static const KEY_AGREE = "KEY_AGREE";

  static final SpUtil _spUtil = SpUtil();

  static setInt(String key, int value) async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    sp.setInt(key, value);
  }

  static Future<int> getInt(String key, int def) async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    return sp.getInt(key) ?? def;
  }

  static setBool(String key, bool value) async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    sp.setBool(key, value);
  }

  static Future<bool> getBool(String key, bool def) async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    return sp.getBool(key) ?? def;
  }
}